//
// WAR!
//

#include "stagesetup.h"

// Characters
#define CHR_MAIAN_LEADER    0x3d
#define CHR_MAIAN_TEMPLATE  0x3e
#define CHR_SKEDAR_TEMPLATE 0x3f
#define CHR_KING1           0x40
#define CHR_KING2           0x41
#define CHR_KING3           0x42
#define CHR_BLONDE          0x43
#define CHR_MAIAN1          0x44
#define CHR_MAIAN2          0x45
#define CHR_MAIAN3          0x46
#define CHR_MAIAN4          0x47
#define CHR_MAIAN5          0x48

// Objects
#define OBJ_BRIDGE 0x05
#define OBJ_MINE1  0x2f
#define OBJ_MINE2  0x30
#define OBJ_MINE3  0x31
#define OBJ_MINE4  0x32
#define OBJ_MINE5  0x33
#define OBJ_MINE6  0x40

// Stage flags
#define STAGEFLAG_LEADER_DEAD 0x00000100
#define STAGEFLAG_KING1_DEAD  0x00000200
#define STAGEFLAG_KING2_DEAD  0x00000400
#define STAGEFLAG_KING3_DEAD  0x00000800

// AI Lists
#define AILIST_DEFEND       0x0401
#define AILIST_INIT_KING    0x0402
#define AILIST_INIT_LEADER  0x0403
#define AILIST_MAIAN        0x0404
#define AILIST_INIT_MAIAN   0x0405
#define AILIST_SKEDAR       0x0406
#define AILIST_KING1_SKEDAR 0x0407
#define AILIST_KING2_SKEDAR 0x0408
#define AILIST_KING3_SKEDAR 0x0409
#define AILIST_INTRO        0x040a
#define AILIST_OUTRO        0x040b
#define AILIST_HIDE         0x040c
#define AILIST_BLOW_MINES   0x040d

// Other
#define GROUP_MAIANS       1
#define GROUP_KING1_SKEDAR 2
#define GROUP_KING2_SKEDAR 3
#define GROUP_KING3_SKEDAR 4

extern s32 intro[];
extern u32 props[];
extern struct path paths[];
extern struct ailist ailists[];

struct stagesetup setup = {
	NULL,
	NULL,
	NULL,
	intro,
	props,
	paths,
	ailists,
	NULL,
};

u32 props[] = {
	briefing(BRIEFINGTYPE_LOCATION, L_STAT_001)
	briefing(BRIEFINGTYPE_TEXT_PA,  L_STAT_000)
	briefing(BRIEFINGTYPE_TEXT_SA,  L_STAT_002)
	briefing(BRIEFINGTYPE_TEXT_A,   L_STAT_003)

	beginobjective(0, L_STAT_004, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Kill Skedar King."
		complete_flags(STAGEFLAG_KING1_DEAD)
		fail_flags(STAGEFLAG_LEADER_DEAD)
	endobjective

	beginobjective(1, L_STAT_005, (DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Kill Skedar King 2."
		complete_flags(STAGEFLAG_KING2_DEAD)
	endobjective

	beginobjective(2, L_STAT_006, (DIFFBIT_PA | DIFFBIT_PD)) // "Kill Skedar King 3."
		complete_flags(STAGEFLAG_KING3_DEAD)
	endobjective

	chr(0, CHR_MAIAN_LEADER, PAD_STAT_004F, BODY_ELVIS1, HEAD_MAIAN_S, AILIST_INIT_LEADER, 0x004e, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_ALLOWSOFTCOVER | CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x003d, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_CALLISTO)

	chr(0, CHR_MAIAN_TEMPLATE, PAD_STAT_0045, BODY_CISOLDIER, HEAD_RANDOM, AILIST_HIDE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAR34, 0x003e, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_AR34)

	chr(0, CHR_KING1, PAD_STAT_007C, BODY_SKEDARKING, HEAD_RANDOM, AILIST_INIT_KING, 0x007c, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_WARFIRSTKING | CHRFLAG1_ALLOWSOFTCOVER | CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRSKMINIGUN, 0x0040, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_REAPER)

	chr(SPAWNFLAG_ONLYONSA | SPAWNFLAG_ONLYONPA, CHR_KING2, PAD_STAT_0110, BODY_SKEDARKING, HEAD_RANDOM, AILIST_INIT_KING, 0x0091, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_ALLOWSOFTCOVER | CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ENEMY, SQUADRON_03, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRSKROCKET, 0x0041, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_SLAYER)

	chr(SPAWNFLAG_ONLYONPA, CHR_KING3, PAD_STAT_0094, BODY_SKEDARKING, HEAD_RANDOM, AILIST_INIT_KING, 0x0094, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_ALLOWSOFTCOVER | CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
#if VERSION >= VERSION_NTSC_1_0
	weapon(0x0100, MODEL_KINGSCEPTRE, 0x0042, OBJFLAG_AIUNDROPPABLE | OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_ROCKETLAUNCHER_34)
#else
	weapon(0x0100, MODEL_KINGSCEPTRE, 0x0042, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_ROCKETLAUNCHER_34)
#endif

	chr(SPAWNFLAG_IGNORECOLLISION | SPAWNFLAG_BASICGUARD, CHR_BLONDE, PAD_STAT_0077, BODY_SKEDAR, HEAD_MRBLONDE, AILIST_KING1_SKEDAR, 0x0022, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_ALLOWSOFTCOVER | CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAULER, 0x0043, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_DEACTIVATED, 0, 0, WEAPON_MAULER)

	chr(0, CHR_SKEDAR_TEMPLATE, PAD_STAT_007D, BODY_CISOLDIER, HEAD_RANDOM, AILIST_HIDE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAR34, 0x003f, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_AR34)

	chr(0, CHR_MAIAN1, PAD_STAT_0009, BODY_ELVIS1, HEAD_MAIAN_S, GAILIST_IDLE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x0044, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CALLISTO)

	chr(0, CHR_MAIAN2, PAD_STAT_00A4, BODY_ELVIS1, HEAD_MAIAN_S, GAILIST_IDLE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x0045, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CALLISTO)

	chr(0, CHR_MAIAN3, PAD_STAT_0008, BODY_ELVIS1, HEAD_MAIAN_S, AILIST_HIDE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_01, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x0046, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CALLISTO)

	chr(0, CHR_MAIAN4, PAD_STAT_000C, BODY_ELVIS1, HEAD_MAIAN_S, AILIST_HIDE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_01, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x0047, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CALLISTO)

	chr(0, CHR_MAIAN5, PAD_STAT_000D, BODY_ELVIS1, HEAD_MAIAN_S, AILIST_HIDE, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_AIVSAI, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000 | CHRFLAG1_IGNORECOVER | CHRFLAG1_PUNCHHARDER, TEAM_01, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANSMG, 0x0048, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CALLISTO)

	conditional_scenery(1, 0, 2)
	debris(0x0100, MODEL_SKCREV_UNEXP1, PAD_STAT_00E5, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#if VERSION >= VERSION_NTSC_1_0
	debris(0x0100, MODEL_SKCREV_EXP1, PAD_STAT_00E6, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#else
	debris(0x0100, MODEL_SKCREV_EXP1, PAD_STAT_00E6, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#endif
	conditional_scenery(1, 0, 2)
	door(0x0100, MODEL_SKTNL_UNEXP1, PAD_STAT_00E7, OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_DEACTIVATED, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000, 0x00000000, 0x00010000, 0x03e80000, 0x03e80000, 0x00010000, 0, DOORTYPE_SLIDING, 0x00000080, 0x00000001, 0x00010000, 0x00000000, 0x00000000)
#if VERSION >= VERSION_NTSC_1_0
	debris(0x0100, MODEL_SKTNL_EXP1, PAD_STAT_00E8, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#else
	debris(0x0100, MODEL_SKTNL_EXP1, PAD_STAT_00E8, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#endif
	tag(0x1e, 5)
	tag(0x1f, 5)
	tag(0x20, 5)
	tag(0x21, 5)
	tag(0x22, 5)
	stdobject(0x0100, MODEL_SK_FL_NOSHAD_ML, PAD_STAT_014B, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	stdobject(0x0100, MODEL_SK_FL_NOSHAD_MR, PAD_STAT_014C, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	stdobject(0x0100, MODEL_SK_FL_NOSHAD_BL, PAD_STAT_014D, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	stdobject(0x0100, MODEL_SK_FL_NOSHAD_BR, PAD_STAT_014E, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	stdobject(0x0100, MODEL_SK_FL_NOSHAD_T, PAD_STAT_014A, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	tag(0x01, 3)
	tag(0x2a, 2)
	conditional_scenery(1, 0, 0)
	debris(0x0100, MODEL_SK_TEMPLECOLUMN4, PAD_STAT_0111, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_DEBRIS_80000000, 0, 1000)
	tag(0x02, 3)
	tag(0x2b, 2)
	conditional_scenery(1, 0, 0)
	debris(0x0100, MODEL_SK_TEMPLECOLUMN2, PAD_STAT_010A, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_DEBRIS_80000000, 0, 1000)
	tag(0x03, 3)
	tag(0x2c, 2)
	conditional_scenery(1, 0, 0)
	debris(0x0100, MODEL_SK_TEMPLECOLUMN3, PAD_STAT_010B, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_DEBRIS_80000000, 0, 1000)
	tag(0x2d, 2)
	conditional_scenery(1, 0, 0)
	debris(0x0100, MODEL_SK_TEMPLECOLUMN2, PAD_STAT_010C, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_DEBRIS_80000000, 0, 1000)
	tag(0x2e, 2)
	conditional_scenery(1, 0, 0)
	debris(0x0100, MODEL_SK_TEMPLECOLUMN3, PAD_STAT_010D, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_DEBRIS_80000000, 0, 1000)
	tag(0x27, 1)
	tag(0x28, 1)
	tag(0x29, 1)
	tag(0x2f, 5)
	tag(0x30, 5)
	tag(0x31, 5)
	tag(0x32, 5)
	tag(0x33, 5)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_00D5, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_010A, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_010B, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_010C, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_010D, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	tag(0x3d, 1)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_003B, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	stdobject(0x0100, MODEL_SK_SUNNOSHAD1, PAD_STAT_014F, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	stdobject(0x0100, MODEL_SK_SUNNOSHAD2, PAD_STAT_0150, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00EB, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00EC, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00ED, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00EE, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x3e, 2)
	tag(0x3f, 2)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00EF, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000040, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F0, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000040, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x09, 2)
	tag(0x0a, 2)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F1, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F2, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x0d, 2)
	tag(0x0e, 2)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F3, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F4, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F5, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F6, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x0f, 2)
	tag(0x10, 2)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F7, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F8, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x11, 2)
	tag(0x12, 2)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00F9, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0x00000001, 0x00000400)
	door(0x0100, MODEL_SK_DOOR1, PAD_STAT_00FA, OBJFLAG_DEACTIVATED, 0, OBJFLAG3_DOOR_STICKY, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000000, 0x0000012c, 0x00000000, 0xffffffff, 0x00000400)
	tag(0x0c, 1)
	fan(0x0100, MODEL_SK_UNDER_GENERATOR, PAD_STAT_0126, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000, 0x00000444, 0x00000002, 0x01000000)
	fan(0x0100, MODEL_SK_UNDER_TRANS, PAD_STAT_0127, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000, 0x00000444, 0x00000002, 0x01000000)
	fan(0x0100, MODEL_SK_UNDER_TRANS, PAD_STAT_0128, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000, 0x00000444, 0x00000002, 0x01000000)
	tag(0x04, 1)
	stdobject(0x0080, MODEL_SKPUZZLEOBJECT, PAD_STAT_00D4, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE, OBJFLAG2_NOFALL | OBJFLAG2_IMMUNETOGUNFIRE, 0, 1000)
	tag(0x05, 1)
	lift(0x0100, MODEL_SKEDARBRIDGE, PAD_STAT_0136, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000, 0x0136, 0x0136, -1, -1, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000071c, 0x0010aaaa, 0x00000000)
	tag(0x0b, 1)
	multimonitor(0x0099, MODEL_COMHUB, PAD_STAT_0137, OBJFLAG_00000002, 0, 0, 1000, 3, 3, 3, 0)
	tag(0x23, 1)
	stdobject(0x0019, MODEL_RUBBLE1, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x24, 1)
	stdobject(0x0019, MODEL_RUBBLE2, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x25, 1)
	stdobject(0x0019, MODEL_RUBBLE3, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x26, 1)
	stdobject(0x0019, MODEL_RUBBLE4, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x37, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE3, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x38, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE4, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x39, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE5, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x3a, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE6, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x3b, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE3, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x3c, 1)
	stdobject(0x0019, MODEL_SK_JONRUBBLE3, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x36, 1)
	stdobject(0x0100, MODEL_SK_SHUTTLE, -1, OBJFLAG_FALL | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_00FC, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_00FB, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_00FD, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_00FE, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_0100, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_00FF, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_0101, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_0102, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_0104, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_0103, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_0106, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_0105, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_BOT, PAD_STAT_0107, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000eb68, 0x0000eb68, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_SK_CRYOPOD1_TOP, PAD_STAT_0108, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x00010000, 0x00010000, 0x0001aaaa, 0x00002aaa, 0x00002aaa, 0, DOORTYPE_VERTICAL, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	tag(0x40, 1)
	stdobject(0x0019, MODEL_CHRREMOTEMINE, PAD_STAT_003B, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_REMOVEWHENDESTROYED | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_INVISIBLE, 0, 1000)
	pad_effect(PADEFFECT_SPARKS, 0x0112)
	pad_effect(PADEFFECT_SPARKS, 0x0117)
	pad_effect(PADEFFECT_SPARKS, 0x0113)
	pad_effect(PADEFFECT_SPARKS, 0x0114)
	pad_effect(PADEFFECT_SPARKS, 0x0115)
	pad_effect(PADEFFECT_SPARKS, 0x0116)
	pad_effect(PADEFFECT_SPARKS, 0x0118)
	pad_effect(PADEFFECT_SPARKS, 0x0119)
	pad_effect(PADEFFECT_SPARKS, 0x011a)
	pad_effect(PADEFFECT_SPARKS, 0x011b)
	pad_effect(PADEFFECT_SPARKS, 0x011c)
	pad_effect(PADEFFECT_SPARKS, 0x011d)
	pad_effect(PADEFFECT_SPARKS, 0x011e)
	pad_effect(PADEFFECT_SPARKS, 0x011f)
	pad_effect(PADEFFECT_SPARKS, 0x0120)
	pad_effect(PADEFFECT_SPARKS, 0x0121)
	pad_effect(PADEFFECT_SPARKS, 0x0122)
	pad_effect(PADEFFECT_SPARKS, 0x0123)
	pad_effect(PADEFFECT_SPARKS, 0x0124)
	pad_effect(PADEFFECT_SPARKS, 0x0125)
	endprops
};

s32 intro[] = {
	outfit(OUTFIT_MAIAN)
	intro_weapon(WEAPON_PHOENIX, -1)
	ammo(AMMOTYPE_PISTOL, 300)
	ammo(AMMOTYPE_ROCKET, 3)
	ammo(AMMOTYPE_SMG, 100)
	spawn(PAD_STAT_00D7)
	endintro
};

struct path paths[] = {
	{ NULL, 0, 0 },
};

u8 func1001_objectives_failed_msg[] = {
	yield
	set_ailist(CHR_SELF, GAILIST_SHOW_OBJ_FAILED_MSG)
	endlist
};

u8 func1000_counterop[] = {
	yield
	set_chr_team(CHR_ANTI, TEAM_ENEMY)
	set_ailist(CHR_SELF, GAILIST_REBUILD_GROUPS)
	endlist
};

u8 func0403_init_maian_leader[] = {
	stop_chr
	yield
	set_alertness(100)
	set_accuracy(100)
	set_reaction_speed(100)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(300)
	set_recovery_speed(100)
	set_shield(0)
	set_ailist(CHR_SELF, AILIST_DEFEND)
	endlist
};

u8 func0402_init_king[] = {
	set_self_chrflag(CHRCFLAG_LOSEXTRAHEIGHT)
	set_alertness(100)
	set_accuracy(100)
	set_reaction_speed(100)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(300)
	set_recovery_speed(100)
	set_shield(0)
	set_self_chrflag(CHRCFLAG_UNEXPLODABLE)
	set_ailist(CHR_SELF, AILIST_DEFEND)
	endlist
};

u8 func0401_defend[] = {
	set_shotlist(AILIST_DEFEND)
	set_self_chrflag(CHRCFLAG_NOAUTOAIM)
	if_chr_dead(CHR_SELF, /*goto*/ 0x2d)
	if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x2d)
	if_chr_knockedout(CHR_SELF, /*goto*/ 0x2d)
	goto_next(0x06)

	// Dying
	label(0x2d)
	set_shotlist(GAILIST_IDLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Not dying - go to pad
	label(0x06)
	if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
	if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06)

	label(0x03)
		restart_timer
		if_chr_distance_to_pad_gt(CHR_SELF, 500, PAD_PRESET, /*goto*/ 0x06)
		go_to_target_pad(GOPOSFLAG_JOG)

		label(0x06)
		go_to_target_pad(GOPOSFLAG_RUN)

		// Wait until at pad or 1 second has passed
		beginloop(0x04)
			dprint 'G','O',' ','T','O',' ','P','A','D','\n',0,
			if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
			if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06)
			if_timer_gt(60, /*goto*/ 0x2d)
		endloop(0x04)

		// Timer expired - loop again
		label(0x2d)
		goto_first(0x03)

		// At pad
		label(0x06)
		stop_chr

		// Wait for enemy to come into sight, or to be pushed away from pad
		beginloop(0x09)
			if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
			if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x06)
		endloop(0x09)

		// Pushed away from pad - return to it
		label(0x06)
		goto_first(0x03)

		// Line of sight to enemy
		// The first king attacks immediately, while the other kings and Maian
		// leader have a 2 second delay. Suspect this is a @bug; the logic would
		// make more sense if it were the other way around.
		label(0x08)
		if_self_flag_bankx_eq(CHRFLAG1_WARFIRSTKING, TRUE, BANK_1, /*goto*/ 0x2d)
		restart_timer

		beginloop(0x8f)
			if_timer_gt(120, /*goto*/ 0x2d)
		endloop(0x8f)

		label(0x2d)
		if_chr_knockedout(CHR_TARGET, /*goto*/ 0x2d)
		if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2d)
		if_chr_dead(CHR_TARGET, /*goto*/ 0x2d)
		dprint 'D','E','T','E','C','T','E','D','\n',0,
		set_returnlist(CHR_SELF, AILIST_DEFEND)
		set_shotlist(AILIST_DEFEND)
		set_ailist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET)

		label(0x2d)
	goto_first(0x03)

	endlist
};

u8 func1003_spawn_maians[] = {
	yield

	// Wait for intro to finish
	beginloop(0x58)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x2e)
		label(0x2d)
	endloop(0x58)

	label(0x2e)
	yield
	yield
	yield
	yield
	yield
	label(0x04)
	yield
	label(0x06)
	set_morale(50)

	// Loop until a Maian is able to be spawned or counter depleted
	beginloop(0x8d)
		if_morale_lt(1, /*goto*/ 0x06)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_0053, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_0050, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_004D, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_004C, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_004E, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_ELVIS1, HEAD_MAIAN_S, PAD_STAT_004A, AILIST_INIT_MAIAN, 0, /*goto*/ 0x8e)
		reloop(0x8d)

		// Successful spawn
		label(0x8e)
		dprint 'C','R','E','A','T','E','D',' ','1','\n',0,
		yield
		subtract_morale(1)
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		rebuild_teams
		rebuild_squadrons
		if_num_chrs_in_squadron_gt(7, GROUP_MAIANS, /*goto*/ 0x2d)
		reloop(0x8d)

		// Wait 5 seconds
		label(0x2d)
		restart_timer

		beginloop(0x08)
			dprint 'S','Q','U','A','D',' ','F','U','L','L','\n',0,
			if_timer_gt(300, /*goto*/ 0x2d)
		endloop(0x08)

		// If a spot has freed up, go back to the spawning part to spawn another
		label(0x2d)
		if_num_chrs_in_squadron_gt(7, GROUP_MAIANS, /*goto*/ 0x2d)
	endloop(0x8d)

	// Still no free spot, so go back to the 5 second wait
	label(0x2d)
	goto_first(0x08)

	// Counter depleted
	label(0x06)
	yield
	yield
	yield
	yield
	yield
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0405_init_maian[] = {
	set_self_chrflag(CHRCFLAG_NEVERSLEEP)
	set_self_chrflag(CHRCFLAG_RUNFASTER)
	set_chr_team(CHR_SELF, TEAM_ALLY)
	set_squadron(GROUP_MAIANS)
	rebuild_teams
	rebuild_squadrons
	try_equip_weapon(MODEL_CHRMAIANSMG, WEAPON_CALLISTO, 0x00000000, /*goto*/ 0x06)
	label(0x06)
	try_inherit_properties(CHR_MAIAN_TEMPLATE, /*goto*/ 0x2d)
	label(0x2d)
	set_accuracy(100)
	set_reaction_speed(100)
	set_chr_maxdamage(CHR_SELF, 200)
	add_health_or_armor(0)
	set_recovery_speed(100)
	set_shield(0)
	set_self_flag_bankx(CHRFLAG1_NOIDLEANIMS, BANK_1)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, AILIST_MAIAN)
	endlist
};

u8 func0404_maian[] = {
	set_returnlist(CHR_SELF, AILIST_MAIAN)
	set_shotlist(AILIST_MAIAN)
	if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)

	label(0x03)
		set_target_chr(CHR_KING1)
		if_chr_dead(CHR_KING1, /*goto*/ 0x8f)
		if_chr_death_animation_finished(CHR_KING1, /*goto*/ 0x8f)
		if_chr_knockedout(CHR_KING1, /*goto*/ 0x8f)
		goto_next(0x2d)

		// King 1 dead
		label(0x8f)
		set_target_chr(CHR_KING2)
		if_chr_dead(CHR_KING2, /*goto*/ 0x90)
		if_chr_death_animation_finished(CHR_KING2, /*goto*/ 0x90)
		if_chr_knockedout(CHR_KING2, /*goto*/ 0x90)
		goto_next(0x2d)

		// King 2 dead
		label(0x90)
		set_target_chr(CHR_KING3)
		run_to_pad(PAD_STAT_0094)
		goto_next(0x04)

		// Go to king
		label(0x2d)
		try_run_to_target(/*goto*/ 0x04)

		beginloop(0x04)
			dprint 'G','O',' ','T','O',' ','P','A','D','\n',0,
			if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
			if_chr_dead(CHR_TARGET, /*goto*/ 0x06)
			if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x06)
			if_chr_knockedout(CHR_TARGET, /*goto*/ 0x06)
		endloop(0x04)

		// King died while running to him
		label(0x06)
		goto_first(0x03)

		// Maian has line of sight to king
		label(0x08)
		dprint 'D','E','T','E','C','T','E','D','\n',0,
		if_chr_dead(CHR_TARGET, /*goto*/ 0x06)
		if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x06)
		if_chr_knockedout(CHR_TARGET, /*goto*/ 0x06)
		set_returnlist(CHR_SELF, AILIST_MAIAN)
		set_shotlist(AILIST_MAIAN)
		set_ailist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET)

		// King died while fighting
		label(0x06)
	goto_first(0x03)

	endlist
};

u8 func1004_spawn_king1_skedar[] = {
	// Wait for intro to finish
	beginloop(0x58)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x2e)
		label(0x2d)
	endloop(0x58)

	label(0x2e)
	yield
	yield
	yield
	yield
	yield
	label(0x04)
	yield
	label(0x06)
	set_morale(65)

	// Loop until a Skedar is able to be spawned or counter depleted
	beginloop(0x8d)
		if_stage_flag_eq(STAGEFLAG_KING1_DEAD, TRUE, /*goto*/ 0x0e)
		if_morale_lt(1, /*goto*/ 0x06)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0079, AILIST_KING1_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_007D, AILIST_KING1_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0083, AILIST_KING1_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0085, AILIST_KING1_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		reloop(0x8d)

		// Successful spawn
		label(0x8e)
		dprint 'C','R','E','A','T','E','D',' ','1','\n',0,
		yield
		subtract_morale(1)
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		rebuild_teams
		rebuild_squadrons
		if_num_chrs_in_squadron_gt(5, 0x02, /*goto*/ 0x2d)
		reloop(0x8d)

		// Wait for 10 seconds if Maian squad is somewhat full,
		// or wait 1 second if Maian squad is somewhat empty.
		label(0x2d)
		restart_timer

		beginloop(0x08)
			if_stage_flag_eq(STAGEFLAG_KING1_DEAD, TRUE, /*goto*/ 0x0e)
			dprint 'S','Q','U','A','D',' ','F','U','L','L','\n',0,
			if_num_chrs_in_squadron_gt(3, GROUP_MAIANS, /*goto*/ 0x2e)
			if_timer_gt(60, /*goto*/ 0x2d)
			label(0x2e)
			if_timer_gt(600, /*goto*/ 0x2d)
		endloop(0x08)

		// If squad is still full, wait another 1 or 10 seconds
		label(0x2d)
		if_num_chrs_in_squadron_gt(5, GROUP_KING1_SKEDAR, /*goto*/ 0x2d)
	goto_first(0x8d)

	// Spawn more
	label(0x2d)
	goto_first(0x08)

	// Counter depleted
	label(0x06)

	// King 1 dead
	label(0x0e)
	yield
	yield
	yield
	yield
	yield
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1008_spawn_king2_skedar[] = {
	// Wait for intro to finish
	beginloop(0x58)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x2e)
		label(0x2d)
	endloop(0x58)

	// Wait for king 1 to die
	label(0x2e)
	yield

	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_KING1_DEAD, TRUE, /*goto*/ 0x06)
	endloop(0x04)

	// Loop until a Skedar is able to be spawned or counter depleted
	label(0x06)
	set_morale(50)

	beginloop(0x8d)
		if_stage_flag_eq(STAGEFLAG_KING2_DEAD, TRUE, /*goto*/ 0x0e)
		if_morale_lt(1, /*goto*/ 0x06)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_008E, AILIST_KING2_SKEDAR, SPAWNFLAG_ALLOWONSCREEN | SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0090, AILIST_KING2_SKEDAR, SPAWNFLAG_ALLOWONSCREEN | SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_008F, AILIST_KING2_SKEDAR, SPAWNFLAG_ALLOWONSCREEN | SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0091, AILIST_KING2_SKEDAR, SPAWNFLAG_ALLOWONSCREEN | SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		reloop(0x8d)

		// Successful spawn
		label(0x8e)
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		yield
		subtract_morale(1)
		rebuild_teams
		rebuild_squadrons
		if_num_chrs_in_squadron_gt(3, GROUP_KING2_SKEDAR, /*goto*/ 0x2d)
		reloop(0x8d)

		// Wait 15 seconds or until king 2 dead
		label(0x2d)
		restart_timer

		beginloop(0x08)
			if_stage_flag_eq(STAGEFLAG_KING2_DEAD, TRUE, /*goto*/ 0x0e)
			if_timer_gt(900, /*goto*/ 0x2d)
		endloop(0x08)

		// If squad still full, wait another 15 seconds, otherwise loop back to
		// the spawning code.
		label(0x2d)
		if_num_chrs_in_squadron_gt(3, GROUP_KING2_SKEDAR, /*goto*/ 0x2d)
	endloop(0x8d)

	label(0x2d)
	goto_first(0x08)

	// Counter depleted
	label(0x06)
	yield
	yield
	yield
	yield
	yield
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	label(0x0e)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100c_spawn_king3_skedar[] = {
	// Wait for intro to finish
	beginloop(0x58)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x2e)
		label(0x2d)
	endloop(0x58)

	// Wait for king 2 to die
	label(0x2e)
	yield

	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_KING2_DEAD, TRUE, /*goto*/ 0x06)
	endloop(0x04)

	// Loop until a Skedar is able to be spawned or counter depleted
	label(0x06)
	set_morale(50)

	beginloop(0x8d)
		if_stage_flag_eq(STAGEFLAG_KING3_DEAD, TRUE, /*goto*/ 0x0e)
		if_morale_lt(1, /*goto*/ 0x06)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0095, AILIST_KING3_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0096, AILIST_KING3_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_012E, AILIST_KING3_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		try_spawn_chr_at_pad(BODY_SKEDAR, HEAD_RANDOM, PAD_STAT_0132, AILIST_KING3_SKEDAR, SPAWNFLAG_BASICGUARD, /*goto*/ 0x8e)
		reloop(0x8d)

		// Successful spawn
		label(0x8e)
		yield
		subtract_morale(1)
		rebuild_teams
		rebuild_squadrons
		if_num_chrs_in_squadron_gt(5, 0x04, /*goto*/ 0x2d)
		reloop(0x8d)

		// Squad full - wait 15 seconds or for king 3 to die
		label(0x2d)
		restart_timer

		beginloop(0x08)
			if_stage_flag_eq(STAGEFLAG_KING3_DEAD, TRUE, /*goto*/ 0x0e)
			if_timer_gt(900, /*goto*/ 0x2d)
		endloop(0x08)

		// Spawn more or wait another 15 seconds
		label(0x2d)
		if_num_chrs_in_squadron_gt(5, GROUP_KING3_SKEDAR, /*goto*/ 0x2d)
	endloop(0x8d)

	label(0x2d)
	goto_first(0x08)

	// Countdown depleted
	label(0x06)
	yield
	yield
	yield
	yield
	yield
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	label(0x0e)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0407_king1_skedar[] = {
	try_equip_weapon(MODEL_CHRMAULER, WEAPON_MAULER, 0x00000000, /*goto*/ 0x06)
	label(0x06)
	try_inherit_properties(CHR_SKEDAR_TEMPLATE, /*goto*/ 0x2d)
	label(0x2d)
	set_squadron(GROUP_KING1_SKEDAR)
	set_chr_team(CHR_SELF, TEAM_ENEMY)
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_BASICGUARD)
	set_accuracy(10)
	set_reaction_speed(50)
	set_chr_maxdamage(CHR_SELF, 150)
	add_health_or_armor(80)
	set_recovery_speed(100)
	set_shield(0)
	set_self_flag_bankx(CHRFLAG1_NOIDLEANIMS, BANK_1)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, AILIST_SKEDAR)
	endlist
};

u8 func0408_king2_skedar[] = {
	try_equip_weapon(MODEL_CHRMAULER, WEAPON_MAULER, 0x00000000, /*goto*/ 0x06)
	label(0x06)
	try_inherit_properties(CHR_SKEDAR_TEMPLATE, /*goto*/ 0x2d)
	label(0x2d)
	set_squadron(GROUP_KING2_SKEDAR)
	set_chr_team(CHR_SELF, TEAM_ENEMY)
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_BASICGUARD)
	set_accuracy(10)
	set_reaction_speed(50)
	set_chr_maxdamage(CHR_SELF, 150)
	add_health_or_armor(80)
	set_recovery_speed(100)
	set_shield(0)
	set_self_flag_bankx(CHRFLAG1_NOIDLEANIMS, BANK_1)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, AILIST_SKEDAR)
	endlist
};

u8 func0409_king3_skedar[] = {
	try_equip_weapon(MODEL_CHRMAULER, WEAPON_MAULER, 0x00000000, /*goto*/ 0x06)
	label(0x06)
	try_inherit_properties(CHR_SKEDAR_TEMPLATE, /*goto*/ 0x2d)
	label(0x2d)
	set_squadron(GROUP_KING3_SKEDAR)
	set_chr_team(CHR_SELF, TEAM_ENEMY)
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_BASICGUARD)
	set_accuracy(10)
	set_reaction_speed(50)
	set_chr_maxdamage(CHR_SELF, 150)
	add_health_or_armor(80)
	set_recovery_speed(100)
	set_shield(0)
	set_self_flag_bankx(CHRFLAG1_NOIDLEANIMS, BANK_1)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, AILIST_SKEDAR)
	endlist
};

u8 func0406_skedar[] = {
	set_shotlist(AILIST_SKEDAR)
	if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
	label(0x03)

	// Go to Maian leader
	set_target_chr(CHR_MAIAN_LEADER)
	try_run_to_target(/*goto*/ 0x04)

	beginloop(0x04)
		dprint 'G','O',' ','T','O',' ','P','A','D','\n',0,
		if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08)
	endloop(0x04)

	label(0x08)
	dprint 'D','E','T','E','C','T','E','D','\n',0,
	set_returnlist(CHR_SELF, AILIST_SKEDAR)
	set_shotlist(AILIST_SKEDAR)
	set_ailist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET)
	endlist
};

u8 func1005_check_leader_dead[] = {
	beginloop(0x03)
		if_chr_death_animation_finished(CHR_MAIAN_LEADER, /*goto*/ 0x2d)
		if_chr_dead(CHR_MAIAN_LEADER, /*goto*/ 0x2d)
		if_chr_knockedout(CHR_MAIAN_LEADER, /*goto*/ 0x2d)
	endloop(0x03)

	label(0x2d)
	show_hudmsg(CHR_BOND, L_STAT_007) // "Maian leader has been killed."
	set_stage_flag(STAGEFLAG_LEADER_DEAD)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1009_check_king1_dead[] = {
	set_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED)

	beginloop(0x03)
		if_chr_death_animation_finished(CHR_KING1, /*goto*/ 0x2d)
		if_chr_dead(CHR_KING1, /*goto*/ 0x2d)
		if_chr_knockedout(CHR_KING1, /*goto*/ 0x2d)
	endloop(0x03)

	label(0x2d)
	show_hudmsg(CHR_BOND, L_STAT_008) // "Skedar King has been killed."
	set_stage_flag(STAGEFLAG_KING1_DEAD)
	unlock_door(0x3e, 0x40)
	unlock_door(0x3f, 0x40)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100a_check_king2_dead[] = {
	set_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED)
	if_difficulty_lt(DIFF_SA, /*goto*/ 0x0e)

	beginloop(0x03)
		if_chr_death_animation_finished(CHR_KING2, /*goto*/ 0x2d)
		if_chr_dead(CHR_KING2, /*goto*/ 0x2d)
		if_chr_knockedout(CHR_KING2, /*goto*/ 0x2d)
	endloop(0x03)

	label(0x2d)
	show_hudmsg(CHR_BOND, L_STAT_008) // "Skedar King has been killed."
	set_stage_flag(STAGEFLAG_KING2_DEAD)
	label(0x0e)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100b_check_king3_dead[] = {
	set_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED)
	if_difficulty_lt(DIFF_PA, /*goto*/ 0x0e)

	beginloop(0x03)
		if_chr_death_animation_finished(CHR_KING3, /*goto*/ 0x2d)
		if_chr_dead(CHR_KING3, /*goto*/ 0x2d)
		if_chr_knockedout(CHR_KING3, /*goto*/ 0x2d)
	endloop(0x03)

	label(0x2d)
	show_hudmsg(CHR_BOND, L_STAT_008) // "Skedar King has been killed."
	set_stage_flag(STAGEFLAG_KING3_DEAD)
	label(0x0e)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1007_check_end_level[] = {
	// Wait for all objectives complete
	beginloop(0x03)
		if_all_objectives_complete(/*goto*/ 0x2d)
	endloop(0x03)

	// Wait 2 seconds
	label(0x2d)
	restart_timer

	beginloop(0x08)
		if_timer_gt(120, /*goto*/ 0x2d)
	endloop(0x08)

	// Check Jo not dead
	label(0x2d)
	if_chr_death_animation_finished(CHR_BOND, /*goto*/ 0x2d)
	if_chr_dead(CHR_BOND, /*goto*/ 0x2d)
	if_chr_knockedout(CHR_BOND, /*goto*/ 0x2d)
	goto_next(0x06)

	// Check Velvet not dead
	label(0x2d)
	if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x2d)
	if_chr_dead(CHR_COOP, /*goto*/ 0x2d)
	if_chr_knockedout(CHR_COOP, /*goto*/ 0x2d)
	goto_next(0x06)

	// Mission failed
	label(0x2d)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Mission complete
	label(0x06)
	set_ailist(CHR_SELF, AILIST_OUTRO)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func040c_hide[] = {
	label(0x03)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100d_king1_invincible[] = {
	beginloop(0x03)
		if_chr_in_room(CHR_BOND, 0x00, 0x0070, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0071, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0072, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0073, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0074, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0075, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0076, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0077, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0078, /*goto*/ 0x2d)
		if_chr_in_room(CHR_BOND, 0x00, 0x0079, /*goto*/ 0x2d)
		set_chr_chrflag(CHR_KING1, CHRCFLAG_INVINCIBLE)
		reloop(0x03)

		label(0x2d)
		unset_chr_chrflag(CHR_KING1, CHRCFLAG_INVINCIBLE)
	endloop(0x03)

	endlist
};

u8 unregistered_function[] = {
	yield

	// Wait for intro to finish
	beginloop(0x58)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x2e)
		label(0x2d)
	endloop(0x58)

	label(0x2e)
	yield
	yield
	yield
	yield
	yield

	// Remove Blonde if counterop doesn't exist
	label(0x03)
	if_chr_death_animation_finished(CHR_ANTI, /*goto*/ 0x2d)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	label(0x2d)
	remove_chr(CHR_BLONDE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1002_intro[] = {
	set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	play_cutscene_track(MUSIC_G5_INTRO)
	set_chr_hiddenflag(CHR_ANTI, CHRHFLAG_00020000)
	set_chr_hiddenflag(CHR_BLONDE, CHRHFLAG_00020000)
	camera_movement(ANIM_CUT_STAT_INTRO_CAM)
	cmd0175(60)

	set_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN1, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 4)

	unset_chr_chrflag(CHR_MAIAN1, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_MAIAN1, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN1, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN2, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN1, 4)

	unset_chr_chrflag(CHR_MAIAN2, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_MAIAN2, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN2, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN3, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN2, 4)

	restart_timer
	fade_to_color(0x000000ff, 0)
	fade_to_color(0x00000000, 110)
	set_cutscene_weapon(CHR_BOND, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_BOND, WEAPON_PHOENIX, WEAPON_NONE)

	// Wait 200 frames (3.3 secs) or until button pressed
	beginloop(0x96)
		if_controller_button_pressed(/*goto*/ 0x82)
		if_timer_gt(200, /*goto*/ 0x06)
	endloop(0x96)

	// Timer expired - play a sound (explosion?)
	label(0x06)
	play_sound(SFX_MAIAN_05E2, CHANNEL_CUTSCENE)

	// Wait for camera to finish or button to be pressed
	beginloop(0x08)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x82)
		label(0x2d)
		if_controller_button_pressed(/*goto*/ 0x82)
		label(0x2d)
	endloop(0x08)

	// Outro done
	label(0x82)
	mute_channel(CHANNEL_CUTSCENE)
	unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_ANTI, CHRHFLAG_00020000)

	unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN1, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 2)

	unset_chr_chrflag(CHR_MAIAN3, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN3, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN2, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN3, 2)

	unset_chr_chrflag(CHR_MAIAN4, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN4, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_INTRO_MAIAN3, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN4, 2)

	set_ailist(CHR_MAIAN1, AILIST_INIT_MAIAN)
	set_ailist(CHR_MAIAN2, AILIST_INIT_MAIAN)
	stop_cutscene_track
	stop_ambient_track
	enter_firstperson
	yield
	label(0x2d)
	set_ailist(CHR_SELF, AILIST_BLOW_MINES)
	endlist
};

u8 func040b_outro[] = {
	set_invincible(CHR_BOND)
	set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	play_cutscene_track(MUSIC_G5_OUTRO)
	camera_movement(ANIM_CUT_STAT_OUTRO_CAM)
	set_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	set_chr_chrflag(CHR_BOND, CHRCFLAG_HIDDEN)

	unset_chr_chrflag(CHR_MAIAN3, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_MAIAN3, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN3, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_OUTRO_MAIAN1, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN3, 4)

	unset_chr_chrflag(CHR_MAIAN4, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_MAIAN4, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN4, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_OUTRO_MAIAN2, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN4, 4)

	unset_chr_chrflag(CHR_MAIAN5, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_MAIAN5, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_MAIAN5, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_STAT_OUTRO_MAIAN3, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MAIAN5, 4)

	show_nonessential_chrs(FALSE)

	// Wait 10 frames or for button press
	restart_timer

	beginloop(0x96)
		if_controller_button_pressed(/*goto*/ 0x82)
		if_timer_gt(10, /*goto*/ 0x06)
	endloop(0x96)

	// Play sound
	label(0x06)
	play_sound(SFX_MAIAN_05E3, CHANNEL_CUTSCENE)

	// Wait 70 frames or for button press
	beginloop(0x97)
		if_controller_button_pressed(/*goto*/ 0x82)
		if_timer_gt(70, /*goto*/ 0x06)
	endloop(0x97)

	// Play sound
	label(0x06)
	play_sound(SFX_MAIAN_05E5, CHANNEL_CUTSCENE)

	// Wait 180 frames or for button press
	beginloop(0x98)
		if_controller_button_pressed(/*goto*/ 0x82)
		if_timer_gt(180, /*goto*/ 0x06)
	endloop(0x98)

	// Play sound
	label(0x06)
	play_sound(SFX_MAIAN_05E7, CHANNEL_CUTSCENE)

	// Wait for outro to finish
	beginloop(0x08)
		if_camera_animating(/*goto*/ 0x2d)
		goto_next(0x82)
		label(0x2d)
		if_controller_button_pressed(/*goto*/ 0x82)
		label(0x2d)
	endloop(0x08)

	label(0x82)
	label(0x06)
	mute_channel(CHANNEL_CUTSCENE)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100f_blow_mines[] = {
	yield

	#define wait(loopid) \
		restart_timer \
 \
		beginloop(loopid) \
			if_timer_gt(120, /*goto*/ 0x2d) \
		endloop(loopid) \
 \
		label(0x2d)

	wait(0x94)
	destroy_object(OBJ_MINE6)
	wait(0x95)
	destroy_object(OBJ_MINE1)
	wait(0x8f)
	destroy_object(OBJ_MINE2)
	wait(0x90)
	destroy_object(OBJ_MINE3)
	wait(0x91)
	destroy_object(OBJ_MINE4)
	wait(0x92)
	destroy_object(OBJ_MINE5)
	wait(0x93)

	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1010_init_lighting[] = {
	yield
	configure_environment(0x0004, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0004, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0005, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0005, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0006, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0006, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0007, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0007, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0008, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0008, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0009, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0009, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000a, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000a, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000b, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000b, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000c, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000c, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000d, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000d, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000e, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000e, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x000f, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x000f, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0010, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0010, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0011, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0011, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0012, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0012, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0013, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0013, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0014, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0014, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0015, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0015, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0016, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0016, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0017, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0017, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0018, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0018, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0019, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0019, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x001a, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x001b, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x001b, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x001d, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x001d, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x001e, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x001e, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x001f, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x001f, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0020, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0020, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0021, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0021, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0022, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0022, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0023, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0023, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0024, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0024, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0025, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0025, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0026, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0026, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0027, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0027, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0028, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0028, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0029, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0029, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002a, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002a, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002b, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002b, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002c, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002c, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002d, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002d, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002e, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002e, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x002f, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x002f, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0030, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0030, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0031, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0031, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x003b, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x003b, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x003c, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x003c, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x003d, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x003d, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x003e, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x003e, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x003f, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x003f, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0040, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0040, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0041, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0041, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0042, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0042, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0043, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0043, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0044, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0044, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0045, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0046, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0047, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0047, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0049, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0049, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x004a, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x004a, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x004b, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x0048, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(0x004f, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0058, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0059, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(0x0059, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

struct ailist ailists[] = {
	{ func1000_counterop,             0x1000 },
	{ func1001_objectives_failed_msg, 0x1001 },
	{ func1002_intro,                 0x1002 },
	{ func1003_spawn_maians,          0x1003 },
	{ func1004_spawn_king1_skedar,    0x1004 },
	{ func1005_check_leader_dead,     0x1005 },
	{ func1007_check_end_level,       0x1007 },
	{ func1008_spawn_king2_skedar,    0x1008 },
	{ func1009_check_king1_dead,      0x1009 },
	{ func100a_check_king2_dead,      0x100a },
	{ func100b_check_king3_dead,      0x100b },
	{ func100c_spawn_king3_skedar,    0x100c },
	{ func100d_king1_invincible,      0x100d },
	{ func100f_blow_mines,            0x100f },
	{ func1010_init_lighting,         0x1010 },
	{ func100f_blow_mines,            0x040d },
	{ func040c_hide,                  0x040c },
	{ func0401_defend,                0x0401 },
	{ func0402_init_king,             0x0402 },
	{ func0403_init_maian_leader,     0x0403 },
	{ func0404_maian,                 0x0404 },
	{ func0405_init_maian,            0x0405 },
	{ func0406_skedar,                0x0406 },
	{ func0407_king1_skedar,          0x0407 },
	{ func0408_king2_skedar,          0x0408 },
	{ func0409_king3_skedar,          0x0409 },
	{ func1002_intro,                 0x040a },
	{ func040b_outro,                 0x040b },
	{ func1002_intro,                 0x0c00 },
	{ func040b_outro,                 0x0c01 },
	{ NULL, 0 },
};
